package com.dyh.quickdemo.demos.beanReplace;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/*
@Author=Joey Wheeler
@Date=2021/1/7 13:18
*/
@RestController
@RequestMapping("/BeanReplaceController")
@Slf4j
public class BeanReplaceController {

//    @Autowired
//    BeanReplaceBiz beanReplaceBiz;

    @Resource
    BeanReplaceBiz beanReplaceBiz;

    @PostMapping("/replace")
    public String replace(@RequestBody() BeanReplaceBiz.ReplaceContext context)  {
        try {
            beanReplaceBiz.replace(context);
        } catch (Exception e){
            log.error("e=",e);
            return "fail";
        }
        return "success";
    }

}
